//
//  XMConversationInviteView.m
//  XunMi
//
//  Created by MacBook on 2024/4/19.
//  Copyright © 2024 TieZhu. All rights reserved.
//

#import "XMConversationInviteView.h"

@interface XMConversationInviteView ()
@property (weak, nonatomic) IBOutlet UIView *boxView;
@property (weak, nonatomic) IBOutlet UIView *guardView;
@property (weak, nonatomic) IBOutlet UIView *giftView;
@property (weak, nonatomic) IBOutlet UIView *audioGiftView;
@property (weak, nonatomic) IBOutlet UIView *videoGiftView;

@property (nonatomic, assign) XMConversationInviteType type;
@property (nonatomic, copy) void(^sendBlock)(XMConversationInviteType type);
@property (nonatomic, copy) void(^inviteBlock)(XMConversationInviteType type);
@end

@implementation XMConversationInviteView

- (void)setupWithType:(XMConversationInviteType)type
            sendBlock:(void (^)(XMConversationInviteType))sendBlock
          inviteBlock:(void (^)(XMConversationInviteType))inviteBlock {
    self.type = type;
    self.sendBlock = sendBlock;
    self.inviteBlock = inviteBlock;
    switch (type) {
        case XMConversationInviteGuard:
            self.boxView.hidden = YES;
            self.guardView.hidden = NO;
            self.giftView.hidden = YES;
            self.audioGiftView.hidden = YES;
            self.videoGiftView.hidden = YES;

            break;
        case XMConversationInviteGift:
            self.boxView.hidden = YES;
            self.guardView.hidden = YES;
            self.giftView.hidden = NO;
            self.audioGiftView.hidden = YES;
            self.videoGiftView.hidden = YES;

            break;
        case XMConversationInviteBox:
            self.boxView.hidden = NO;
            self.guardView.hidden = YES;
            self.giftView.hidden = YES;
            self.audioGiftView.hidden = YES;
            self.videoGiftView.hidden = YES;

            break;
        case XMConversationInviteAudiolGift:
            self.boxView.hidden = YES;
            self.guardView.hidden = YES;
            self.giftView.hidden = YES;
            self.audioGiftView.hidden = NO;
            self.videoGiftView.hidden = YES;

            break;
        case XMConversationInviteVideoGift:
            self.boxView.hidden = YES;
            self.guardView.hidden = YES;
            self.giftView.hidden = YES;
            self.audioGiftView.hidden = YES;
            self.videoGiftView.hidden = NO;

            break;
            
        default:
            break;
    }
}

- (IBAction)sendAction:(UIButton *)sender {
    if (self.sendBlock) {
        self.sendBlock(self.type);
    }
}

- (IBAction)inviteAction:(UIButton *)sender {
    if (self.inviteBlock) {
        self.inviteBlock(self.type);
    }
}

- (IBAction)close:(id)sender {
    [GKCover hideCover];
}

@end
